<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>差错管理</title>
    <link rel="icon" href="favicon.ico" type="image/x-icon"/>
    <!-- 当前页面样式 -->
    <link rel="stylesheet" href="<s:url value="/css/common.css"/>"/>
    <!-- 当前页面样式 END -->
    <script type="text/javascript" src="<c:url value="/js/jquery-1.3.2.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
    <script type="text/javascript">
		function checkSubmit(){
			/* var minDate = $.trim($("#minDate").val());
			var maxDate = $.trim($("#maxDate").val());
			if(!minDate || !maxDate){
				alert("请填写时间范围");
				return false;
			} */
			
			var reasonCd = $.trim($("#reasonCd").val());
			var orderType = $.trim($("#orderType").val());
			
			if(reasonCd){
				if(!orderType){
				alert("请先选择调单类型");
				return false;}
			} 
			
			
			$("#queryOrBtn").attr("disabled",true);
			$("#queryOrProList").attr("action","<%=basePath%>/orpro/queryOrderProcessList.ct");
			$("#queryOrProList").submit();
			
		}
		
		function registerSubmit(){
			$("#szPower").attr("disabled",true);
			window.location.href="<%=basePath%>/orpro/registerInit.ct";
		}
		
		function modifyInit(id){
			$("#updO"+id).attr("disabled",true);
			window.location.href="<%=basePath%>/orpro/modifyInit.ct?riskId="+id;
		}
		
		function deleteRiskOrder(id){
			if(confirm("确认要删除吗？")){
				$("#delO"+id).attr("disabled",true);
				window.location.href="<%=basePath%>/orpro/deleteRiskOrder.ct?delId="+id;
			}
			
		}
		
		function importSubmit(){
			window.location.href="<%=basePath%>/orpro/batchImportInit.ct";
		}
		
		function exportSubmit(){
			var minDate = $.trim($("#minDate").val());
			var maxDate = $.trim($("#maxDate").val());
			if(!minDate || !maxDate){
				alert("请填写时间范围");
				return false;
			}
			/*  Boolean flag = (to_number(minDate))>(to_number(maxDate));
			if(flag){
				alert("请填写正确的时间");
				return false;
			}  */
			var date1=str2date(minDate);
			var date2=str2date(maxDate);
				
				if(date1.getMonth()!=date2.getMonth()){
				    alert("选择的时间范围不在同一个月内！");
					return false;
				} 
			var reasonCd = $.trim($("#reasonCd").val());
			var orderType = $.trim($("#orderType").val());
			 if(!orderType){
				alert("请先选择调单类型");
				return false;}
			 
			 if(!!reasonCd){
				if(!orderType){
				alert("请先选择调单类型");
				return false;}
			}  
			$("#queryOrProList").attr("action","<%=basePath%>/orpro/exportOrderProcessList.ct");
			$("#queryOrProList").submit();
			/* $("#queryBtnId").attr("disabled","true"); */
		}
		
		function   str2date(str){   
			var   d=null;   
			var   reg=/^(\d{4})(\d{2})(\d{2})$/  ;
			if(arr=str.match(reg)) d=new Date(Number(arr[1]),Number(arr[2])-1,Number(arr[3])) ; 
			return   d;   
		}
	</script>
</head>
<body>
<s:form id="queryOrProList" action="" method="post" theme="simple">
<table class="tb">
    <tbody>
        <tr class="tb-line">
            <td class="tb-td" colspan="4"><div class="tb-h2">POS收单运营管理平台</div></td>
        </tr>

        <tr class="tb-line">
            <td class="tb-td" colspan="4"><div class="tb-h3">差错管理</div></td>
        </tr>

        <tr class="tb-line">
        	<td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">商户号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal"><s:textfield id="mchtCd" name="searchCondition.mchtCd" cssClass="queryWidth" /></label>
            </td>
        	
        	<td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">账号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal"><s:textfield id="accountNo" name="searchCondition.accountNo" cssClass="queryWidth" /></label>
            </td>
            
         </tr>
         
         <tr class="tb-line">
         	<td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">日期范围：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-mini"><s:textfield id="minDate"  name="searchCondition.minDate" 
                onfocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});" 
                /></label>-<label class="tb-input-mini"><s:textfield id="maxDate"  name="searchCondition.maxDate" 
                onfocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});" 
                /></label><code class="asterisk">*</code>
            </td>
           
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">调单类型：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:select id="orderType" name="searchCondition.orderType" 
                		cssClass="queryWidth" list="#request.orderTypeMap" 
                		listKey="key" listValue="value" headerKey="" headerValue="--请选择--"></s:select>
                		<code class="asterisk">*</code>
                </label>
            </td>
            
         </tr>
         
          <tr class="tb-line">
         	 <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">原因码：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:select id="reasonCd" name="searchCondition.reasonCd" 
                		cssClass="queryWidth" list="#request.reasonCdMap" 
                		listKey="key" listValue="value" headerKey="" headerValue="--请选择--"></s:select>
                </label>
            </td>
         </tr>
         
          

        <tr class="tb-line">
            <td class="tb-td line-submit" align="right" colspan="4">
                <label class="tb-input-submit">
                    <input type="button" value="查   询" onclick="return checkSubmit();" id="queryOrBtn"/>
                </label>
                <label class="tb-input-submit">
                    <input id="szPower" type="button" value="登  记" onclick="return registerSubmit();"/>
                </label>
                <label class="tb-input-submit">
                    <input id="szImport" type="button" value="批量导入" onclick="return importSubmit();"/>
                </label>
                <label class="tb-input-submit">
	                <s:if 
						 test="#request.searchRsList != null && #request.searchRsList.size>0">
						   		<input id="szExport" type="button"
								value="导 出" onclick="return exportSubmit();"/>
						   
						</s:if>
						<s:else>
						 	<input id="szPower" disabled="disabled" value="导  出" type="button" /> 
						</s:else>
				</label>
            </td>
        </tr>
        
        <tr class="tb-line">
				<td colspan="4" align="center"><span style="color: red"><s:actionerror /></span>
					<span style="color: red;"><s:actionmessage /></span> <span
					style="color: red;"><s:fielderror cssClass="fieldError" /></span>
					<span id="otherError"></span></td>
		</tr>
        <s:if test="#request.searchRsList != null && #request.searchRsList.size>0">
					<tr class="tb-line">
						<td class="tb-td paging"  align="left" colspan="4"> <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/orpro/queryOrderProcessList.ct?currentPage=" />

						</td>
					</tr>
	</s:if>
    </tbody>
    
</table>

<div class="big-tb">
    <table class="tb" style="width: 100%;">
        <thead>
            <tr class="tb-line">
                <th class="tb-th" colspan="33">差错列表</th>
            </tr>
            <tr class="tb-line bg-gray">
                		<th class="tb-th">商户号</th>
						<th class="tb-th">交易账号</th>
						<th class="tb-th">系统参考号</th>
						<th class="tb-th">交易金额</th>
						
						<th class="tb-th">清算/交易 日期</th>
						<th class="tb-th">查询</th>
						<th class="tb-th">查询日期</th>
						<th class="tb-th">二次查询</th>
						<th class="tb-th">二次查询日期</th>
						<th class="tb-th">调单</th>
						<th class="tb-th">调单日期</th>
						<th class="tb-th">二次调单</th>
						<th class="tb-th">二次调单日期</th>
						<th class="tb-th">贷记调整</th>
						<th class="tb-th">贷记调整日期</th>
						<th class="tb-th">请款</th>
						<th class="tb-th">请款日期</th>
						<th class="tb-th">退单</th>
						<th class="tb-th">退单日期</th>
						<th class="tb-th">二次请款</th>
						<th class="tb-th">二次请款日期</th>
						<th class="tb-th">二次退单</th>
						<th class="tb-th">二次退单日期</th>
						<th class="tb-th">例外协商</th>
						<th class="tb-th">例外协商日期</th>
						<th class="tb-th">例外长款</th>
						<th class="tb-th">例外长款日期</th>
						<th class="tb-th">托收请款</th>
						<th class="tb-th">托收请款日期</th>
						<th class="tb-th">托收协商</th>
						<th class="tb-th">托收协商日期</th>
						<th class="tb-th">操作员</th>
						<th class="tb-th">操作</th>
            </tr>
        </thead>
				<tbody>
					<s:iterator value="#request.searchRsList" status="stat" id="mt">
						<tr class="tb-line">
							<td class="tb-td"><s:property value="#mt.merchantNo" /></td>
							<td class="tb-td"><s:property value="#mt.accountNo" /></td>
							<td class="tb-td"><s:property value="#mt.systemNo" /></td>
							<td class="tb-td"><s:property value="#mt.transAmt" /></td>
							
							<td class="tb-td"><s:property value="#mt.transDate" /></td>
							<td class="tb-td">
								
								<s:property value="#mt.firstQuery" />
							</td>
							
							<td class="tb-td"><s:property value="#mt.firstQueryDate" /></td>
							
							<td class="tb-td">
								
								<s:property value="#mt.secondQuery" />
							</td>
							<td class="tb-td"><s:property value="#mt.secondQueryDate" /></td>
							
							<td class="tb-td">
								
								<s:property value="#mt.firstSurvey" />
							</td>
							<td class="tb-td"><s:property value="#mt.firstSurveyDate" /></td>
							
							<td class="tb-td">
								
								<s:property value="#mt.secondSurvey" />
							</td>
							<td class="tb-td"><s:property value="#mt.secondSurveyDate" /></td>
							
							<td class="tb-td">
								
								<s:property value="#mt.loanAdjust" />
							</td>
							<td class="tb-td"><s:property value="#mt.loanAdjustDate" /></td>
							
							<td class="tb-td">
								
								<s:property value="#mt.firstWithdrawCash" />
							</td>
							<td class="tb-td"><s:property value="#mt.firstWithDrawCashDate" /></td>
							
							<td class="tb-td">
								
								<s:property value="#mt.firstChargeBack" />
							</td>
							<td class="tb-td"><s:property value="#mt.firstChargeBackDate" /></td>
							
							<td class="tb-td">
								
								<s:property value="#mt.secondWithDrawCash" />
							</td>
							<td class="tb-td"><s:property value="#mt.secondWithDrawCashDate" /></td>
							
							<td class="tb-td">
								
								<s:property value="#mt.secondChargeBack" />
							</td>
							<td class="tb-td"><s:property value="#mt.secondChargeBackDate" /></td>
							
							<td class="tb-td">
								
								<s:property value="#mt.exceptionNegotiate" />
							</td>
							<td class="tb-td"><s:property value="#mt.exceptionNegotiateDate" /></td>
							
							<td class="tb-td">
								
								<s:property value="#mt.exceptionLongMoney" />
							</td>
							<td class="tb-td"><s:property value="#mt.exceptionLongMoneyDate" /></td>
							
							<td class="tb-td">
								
								<s:property value="#mt.collectionWithDrawCash" />
							</td>
							<td class="tb-td"><s:property value="#mt.collectionWithDrawCashDate" /></td>
							
							<td class="tb-td">
								<s:property value="#mt.collectionNegotiate" />
							</td>
							<td class="tb-td"><s:property value="#mt.collectionNegotiateDate" /></td>
							
							<td class="tb-td"><s:property value="#mt.oper" /></td>
							<td nowrap="nowrap"><label><input type="button" onclick="modifyInit(${mt.id}) " value="修  改" id="updO${mt.id}"> <input onclick="deleteRiskOrder(${mt.id}) " type="button" value="删 除" id="delO${mt.id}"/></label></td>
						</tr>
					</s:iterator>
				</tbody>
			</table>
</div>
</s:form>

<s:if test="#request.msg !=null">
		<script language="javascript">
			alert("${request.msg}");
		</script>
	</s:if>
</body>
</html>